<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 一、Mustache语法 插值语法 -->
    <div id="app">
        <!-- 基本使用 -->
        <h1>{{message}}</h1>
        <h2>当前计数：{{counter}}</h2>
        <!-- 表达式 -->
        <h2>计数双倍：{{ counter*2 }}</h2>
        <h2>展示信息:{{name.split(" ")}}</h2>
        <!-- 三元运算符 -->
        <h2>小染是{{age>18?"成年人":"未成年人"}}</h2>
        <!-- 不能定义语句 -->
        <!-- 函数 -->
        <h2>当前时间是{{nowtime(time)}}</h2>
    </div>

    <script src="https://unpkg.com/vue@next"></script>
    <script>
        //用vue创建app
        const app = Vue.createApp({
            data: function () {
                return {
                    message: "Hello word",
                    counter: 100,
                    name: "my name is 亦小染",
                    age: 19,
                    time:"3-20"
                }
            },
            methods:{
                nowtime(date){
                    return "2023-"+date
                }
            }
        })
        //挂载app
        app.mount("#app")
    </script>
    
</body>
</html>
